package www.wen.com.common.lib.util

import android.content.Context
import android.content.pm.PackageManager
import www.wen.com.common.lib.app.BaseApplication.Companion.CONTEXT

/**
 * @author WEN
 * @Description:
 * @date 2020/12/3 17:46
 */
object AppInfoUtil {

    @JvmStatic
    fun getAppVersionCode(context: Context = CONTEXT): String {
        var localVersion = ""
        try {
            val packageInfo = context.applicationContext.packageManager.getPackageInfo(context.packageName, 0)
            localVersion = packageInfo.versionName
        } catch (e: PackageManager.NameNotFoundException) {
            e.printStackTrace()
            return localVersion
        }
        return localVersion
    }

}